package com.runvp.common.enums;


/**
 * 账变类型
 * @author xukk_dp
 */

public enum BillChangeType implements BaseEnumInterface {

    OUT("out", "支出"),
    IN("in", "收入");

    private final String code;
    private final String desc;
    private String defaulted;

    @Override
    public String getDefaulted() {
        return defaulted;
    }


    BillChangeType(String code, String desc, String defaulted) {
        this.code = code;
        this.desc = desc;
        this.defaulted = defaulted;
    }


    BillChangeType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    @Override
    public String getCode() {
        return code;
    }
    @Override
    public String getDesc() {
        return desc;
    }


    /**
     * 根据key获取对应value
     * @param code
     * @return str
     */
    public static String getDesc(String code) {
        if(null == code || "".equals(code)){return  "未知" ;}
        for (BillChangeType e: BillChangeType.values()){
            if(code.equals(e.getCode())){
                return e.getDesc();
            }
        }
        return "未知";
    }
}
